from common.base import AbstractBaseModel
from common.base import fields


class User(AbstractBaseModel):
    username = fields.CharField(max_length=20, unique=True)
    password = fields.CharField(max_length=128)
    mobile = fields.CharField(max_length=11, unique=True, null=True)
    email_active = fields.BooleanField(default=False, description='邮箱激活状态')
    email = fields.CharField(max_length=64, description='邮箱', null=True, unique=True)
    default_address = fields.OneToOneField('models.Address', on_delete=fields.SET_NULL, null=True, description='默认收获地址')

    class Meta:
        table = "tb_users"
